package com.wxapp.common.constant.base;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author lgl
 * @Description 获取信息
 * @Datetime 2022/6/15 17:47
 * @Modified By
 */
@Data
public class IBaseResponse implements Serializable {
    /**
     * id 生成策略为UUID
     */
    private String id;

    /**
     * 是否删除 一般默认不删除 false
     */
    private Boolean status;

    /**
     * 创建者 填充策略为插入自动填充
     */
    private String createBy;

    /**
     * 创建时间 填充策略为插入自动填充
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class) //反序列化时
    @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化时
    private LocalDateTime createTime;

    /**
     * 更新者 填充策略为插入和更新填充字段
     */
    private String updateBy;

    /**
     * 更新时间 填充策略为插入和更新填充字段
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class) //反序列化时
    @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化时
    private LocalDateTime updateTime;
}
